package com.dswz.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.dswz.dao.CatalogDao;
import com.dswz.po.Catalog;
import com.dswz.service.CatalogService;

@Service("catalogService")
@Transactional
public class CatalogServiceImpl implements CatalogService {
	@Autowired
	private CatalogDao catalogDao;

	public List<Catalog> getCatalogList() {
		return catalogDao.selectAll();
	}

	public void insertCatalog(Catalog paramCatalog) throws Exception {
		catalogDao.insertSelective(paramCatalog);
	}

	public void deleteCatalogs(List<Integer> paramList) throws Exception {
		for (int i = 0; i < paramList.size(); i++) {
			catalogDao.deleteByPrimaryKey(paramList.get(i));
		}
	}

	public void deleteCatalog(Integer id) throws Exception {
		catalogDao.deleteByPrimaryKey(id);
	}

	public void updateCatalog(Catalog paramCatalog) throws Exception {
		catalogDao.updateByPrimaryKeySelective(paramCatalog);
	}

	public Catalog getCatalogById(Integer id) throws Exception {
		return catalogDao.selectByPrimaryKey(id);
	}

}
